package edu.cmu.vlis.datamining.tools;

import java.util.List;
import java.util.Map;

import org.jgrapht.graph.Multigraph;

//import weka.core.Instance;
//import weka.core.Instances;

import edu.cmu.vlis.datamining.core.Edge;
import edu.cmu.vlis.datamining.core.Feature;
import edu.cmu.vlis.datamining.core.Vertex;

public class DatasetCreator {

   /* private Multigraph<Vertex, Edge> trgGraph;
    public DatasetCreator(Multigraph<Vertex , Edge> _graph) {
        this.trgGraph = _graph;
    }
    *//** Go through each vertex of training graph, then iterate through features map of each vertex 
     * and label the vertex pair as +ve if an edge exists between them in test graph; otherwise label
     * as negative. 
     *//*

    public Instances prepareDataset(Multigraph<Vertex, Edge> testGraph,
                                                Map<String,Vertex> testVertexMap){
        
        Instances dataset = new Instances("graph",null,1000);
        dataset.setClassIndex(0);
        for(Vertex trgVertexOuter : this.trgGraph.vertexSet()){
            
            Map<Vertex,List<Feature>> featureMap = trgVertexOuter.getFeatures();
            for(Vertex trgVertexInner : featureMap.keySet()){
                List<Feature> features = featureMap.get(trgVertexInner);
                double[] featureVals = new double[features.size()];
                for(int i=0; i< features.size(); i++)
                    featureVals[i] = (Double)features.get(i).getValue();
                
                Instance instance = new Instance(1,featureVals);
                instance.setClassValue(testGraph.containsEdge(
                        testVertexMap.get(trgVertexOuter.getBlogUrl()),
                        testVertexMap.get(trgVertexInner.getBlogUrl())) ? 1 : 0);
                dataset.add(instance);
            }
        }
        return dataset;
    }
*/
}
